package com.iemes.controller.finance;


import java.util.List;
import java.util.Map;

import javax.inject.Inject;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.iemes.controller.index.BaseController;
import com.iemes.entity.FineFormMap;
import com.iemes.mapper.finance.FineMapper;
import com.iemes.plugin.PageView;
import com.iemes.util.Common;

@RequestMapping("/finance")
@Controller
public class FineController extends BaseController {

	@Inject
	private FineMapper fineMapper;
	
	
	@RequestMapping("fine")
	private String fine(Model model){
		model.addAttribute("res", findByRes());
		return Common.BACKGROUND_PATH + "/finance/receivablesmanagement/fine_list";
	}
	
	
	@ResponseBody
	@RequestMapping("fine_findByPage")
	public PageView findByPage(String pageNow, String pageSize) throws Exception 
	{
		FineFormMap fineFormMap=getFormMap(FineFormMap.class);
		fineFormMap=toFormMap(fineFormMap, pageNow, pageSize, fineFormMap.getStr("orderby"));
		List<FineFormMap> fineFormMaps=fineMapper.findByPage(fineFormMap);
		pageView.setRecords(fineFormMaps);
		return pageView;
	}
}
